using DevExpress.XtraEditors;
using UI.Helper;

namespace UI.Base
{
    public class DialogViewBase : XtraForm, IForm
    {
        protected PrecisionHelper PrecisionHelper;

        public DialogViewBase()
        {
            InitializeComponent();
        }

        protected virtual void InitializeBO()
        {
            PrecisionHelper = new PrecisionHelper();
        }

        protected virtual void PopulateData()
        {
        }

        protected virtual void PopulateStaticData()
        {
        }

        protected virtual void OnActivated()
        {
            PopulateData();
        }

        protected virtual void FormatPrecision()
        {
        }
        
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Load"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data. </param>
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            InitializeBO();
            PopulateStaticData();
	        FormatPrecision();
        }
        
        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // DialogViewBase
            // 
            this.ClientSize = new System.Drawing.Size(284, 262);
            this.Name = "DialogViewBase";
            this.Activated += this.DialogViewBase_Activated;
            this.ResumeLayout(false);

        }

        private void DialogViewBase_Activated(object sender, System.EventArgs e)
        {
            OnActivated();
        }
    }
}
